package serviceimpl;

import mapper.CompanyMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import po.Company;
import service.CompanyService;

import java.util.List;

/**
 * Created by apple on 2017/10/21.
 */

@Component
public class CompanyServiceImpl implements CompanyService{

    @Autowired
    private CompanyMapper companyMapper;

    @Override
    public boolean createCompanyInfo(Company company) {
        return companyMapper.insertCompany(company);
    }

    @Override
    public boolean deleteCompanyInfo(Company company) {
        return companyMapper.deleteCompanyByName(company.getCompanyname());
    }

    @Override
    public boolean updateCompanyInfo(Company company) {
        return companyMapper.updateCompanyById(company);
    }

    @Override
    public Company selectCompanyByCompanyId(Integer companyid) {
        return companyMapper.selectCompanyByCompanyId(companyid);
    }

    @Override
    public Company selectCompanyByCompanyName(String companyname) {
        return companyMapper.selectCompanyByName(companyname);
    }

    @Override
    public List<Company> selectAllCompanysInfo() {
        return companyMapper.selectAllCompanys();
    }

}
